package vin.pth.authorization.exception;

import lombok.Getter;
import lombok.Setter;
import vin.pth.authorization.enums.AuthorizationErrorCode;

/**
 * 授权异常.
 *
 * @author cocoon
 */
@Getter
@Setter
public class AuthorizationException extends Exception {

  private String message;
  private int code;

  public AuthorizationException(AuthorizationErrorCode errorCode) {
    super(errorCode.getMessage());
    this.message = errorCode.getMessage();
    this.code = errorCode.getCode();
  }

  public AuthorizationException(AuthorizationErrorCode errorCode, String message) {
    super(errorCode.getMessage());
    this.message = message;
    this.code = errorCode.getCode();
  }


  public AuthorizationException(int code, String message) {
    super(message);
    this.message = message;
    this.code = code;
  }
}
